package phoeics.authoryserver.webservice.security;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.oauth2.config.annotation.builders.ClientDetailsServiceBuilder;
import org.springframework.security.oauth2.provider.ClientDetails;
import org.springframework.security.oauth2.provider.ClientDetailsService;
import org.springframework.stereotype.Component;

import phoeics.authoryserver.webservice.service.RedisService;
@Component
public class RedisClientDetailsServiceBuilder extends ClientDetailsServiceBuilder<RedisClientDetailsServiceBuilder> {
	private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(RedisClientDetailsServiceBuilder.class);
	@Autowired
	RedisService redisService;
	@Resource(name="redisClientDetailsService")
	ClientDetailsService clientDetailsService;
	@Override
	protected void addClient(String clientId, ClientDetails build) {
		redisService.set(clientId, build);
	}
	 @Override
	    protected ClientDetailsService performBuild() {
		 return this.clientDetailsService;
	 }
}
